import { useModel } from "umi";
import compress from "gql-compress";

const updateOrganizationPositionByOpUuid = compress(`mutation MyMutation($opUuid: UUID!, $opDesc: String, $opName: String!) {
  updateOrganizationPositionByOpUuid(
    input: {
      organizationPositionPatch: { opDesc: $opDesc, opName: $opName }
      opUuid: $opUuid
    }
  ){
      clientMutationId
  }
}`);

const useUpdatePosition = () => {
    const { graphqlFetch } = useModel("global");

    const updatePosition = async (variables) => {
        let res = await graphqlFetch({
            query: updateOrganizationPositionByOpUuid,
            variables,
        });
        return res ? true : false;
    };

    return { updatePosition };
};

export default useUpdatePosition;
